def train_2d(alpha):
    x1, x2  = -5, -2     results = [(x1, x2)]
    for i in range(20): # 迭代20次
        x1 = x1- alpha * 2 * x1
        x2 = x2 - alpha * 4 * x2
        results.append((x1, x2))
    print('epoch %d, x1 %f, x2 %f' % (i + 1, x1, x2))
    return results
results = train_2d(alpha=0.1)
show_trace(results)
